/* 销售-销售单
 */

import { getRequest, postRequest, getDownload, uploadRequest } from '@/lib/axios'

export const salesApi = {
  // 销售单列表
  queryList: (param) => {
    return getRequest('/order/list', param)
  },
  // 详情
  detail: (param) => {
    return getRequest('/order/detail', param)
  },
  // 访销单新增
  create: (param) => {
    return postRequest('/order/add', param)
  },
  // 访销单编辑
  edit: (param) => {
    return postRequest('/order/edit', param)
  },
  // 访销单修改
  modify: (param) => {
    return postRequest('/order/modify', param)
  },
  // 销售单取消
  cancel: (id: number) => {
    return postRequest('/order/modify', { id })
  },
  // 删除已取消订单
  del: (params) => {
    return postRequest('/order/del', params)
  },
  // 导出
  exportXlsx: (params) => {
    return getDownload('/order/exportXlsx', params)
  },
  // 下载模版
  exportTpl: (params) => {
    return getDownload('/order/exportTpl', params)
  },
  // 导入
  importXlsx: (data) => {
    return uploadRequest('/order/importXlsx', data)
  }
}
